package cz.tomasdvorak.cars.wicket.components.table;

import org.apache.wicket.extensions.markup.html.repeater.data.table.NoRecordsToolbar;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.ResourceModel;

/**
 * To be able to localize "no records" message differently on different pages.
 */
public class LocalizableNoRecordsToolbar extends NoRecordsToolbar {
    private static final ResourceModel NO_RECORDS_MESSAGE =
            new ResourceModel("datatable.no-records-found", "No Records Found");

    public LocalizableNoRecordsToolbar(final DataTable table) {
        super(table, new AbstractReadOnlyModel<String>() {
            public String getObject() {
                return NO_RECORDS_MESSAGE.wrapOnAssignment(table).getObject();
            }
        });
    }
}
